import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import * as THREE from "three";

const loader = new GLTFLoader();
const mesh1 = new THREE.Group();
loader.load("/assets/model/Flamingo.glb", (gltf) => {
	console.log(gltf);
	mesh1.add(gltf.scene);
	gltf.scene.scale.set(3, 3, 3);
    gltf.scene.position.set(400, 0, 400);

    const mixer = new THREE.AnimationMixer(gltf.scene);
    const action = mixer.clipAction(gltf.animations[0]);
    action.play();

    const clock = new THREE.Clock();
    function render() {
        const delta = clock.getDelta();
        mixer.update(delta);
        requestAnimationFrame(render);
    }
    render();
});

export { mesh1 };
